package com.gold.service;

import com.gold.dao.UserDao;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

import java.util.Date;

/**
 * @author XiaoHao
 * @date 2022-05-12 12:02
 */
@Component
@Configuration
@EnableScheduling
@Slf4j
public class ScheduleService {
    @Autowired
    UserDao userDao;

    /**
     * 定时更新过期密钥用户状态
     */
    @Scheduled(cron = "0 0 3 * * ?")
    public void clearUser(){
        log.info("定时任务执行---更新过期密钥用户");
        userDao.updateUserExpire();
    }
}
